<?
include_once("./_common.php");

auth_check($auth[$sub_menu], "r");

$token = get_token();

$g4[title] = "정보공개서 관리";
include_once("./admin.head.php");

$sql = " select count(*) as cnt from info_form";
$row = sql_fetch($sql);
$total_count = $row[cnt];


$rows = 10;
$total_page = ceil($total_count / $rows);
if($page == "") $page = 1;
$from_record = ($page -1) * $rows;

$sql = "SELECT *
		  FROM info_form
		 ORDER BY id DESC limit $from_record, $rows";
$rst = sql_query($sql);
$pagelist = get_paging2($rows, $page, $total_page, "$_SERVER[PHP_SELF]?$qstr&bo_table=info&page=");

$i=0;
while($row = mysql_fetch_assoc($rst))
{
	$list[$i] = $row;
	$list[$i]['href'] = "/adm/adm_new/info_view.php?bo_table=info&id=".$list[$i][id];
	$list[$i][num] = $total_count - ($page - 1) * $board[bo_page_rows] - $k;
	$i++;
}

$result = "";


$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "./info_list.php?bo_table=$bo_table".$qstr."&page=");

$list_href = '';
$prev_part_href = '';
$next_part_href = '';
$write_href = "";
if ($member[mb_level] >= $board[bo_write_level])
	$write_href = "./info_write.php?bo_table=$bo_table";

$nobr_begin = $nobr_end = "";
if (preg_match("/gecko|firefox/i", $_SERVER['HTTP_USER_AGENT'])) {
	$nobr_begin = "<nobr style='display:block; overflow:hidden;'>";
	$nobr_end   = "</nobr>";
}

?>

<style>

table.p_t {width:100%}
table.p_t tr {line-height:24px;}
table.p_t th {background:url(/test/manage/imgs/tit_bg.gif) repeat-x;height:38px;color:white;line-height:16px;font-weight:normal;}
table.p_t th {border-bottom:1px solid #CCCCCC}
table.p_t td {border-bottom:none;}
table.p_t td {text-align:center;height:30px;}
table.p_t td a {color:black}
.mb15 {margin-bottom:15px;}

</style>

<?=subtitle("정보공개서")?>

<div>
	<br />
	<div class="select_store_wrap" style="overflow:hidden">
		<!--<div style="float:left">
			<select name="select_store" class="select_store">
			<option value="all">전체지점</option>
			<?php
			for($i = 0; $i < count($store); $i += 1) { ?>
			<option value="<?php echo $store[$i]['wr_1']?>"><?php echo $store[$i]['wr_1']?></option>
			<? } ?>
			</select>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<select name="name1" class="name1">
			<option value="all">전체방문자</option>
			<?php
			for($i = 0; $i < count($name1); $i += 1) { ?>
			<option value="<?php echo $name1[$i]['vi_name1']?>"><?php echo $name1[$i]['vi_name1']?></option>
			<? } ?>
			</select>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<img src="<?php echo $g4['path']?>/test/manage/imgs/search_btn.gif" class="ajax_rst" style="cursor:pointer;vertical-align:bottom" title="검색" />
		</div>
		
		<div style="float:right">
			<img src="<?php echo $g4['path']?>/test/manage/imgs/excel_btn.gif" class="excel_btn" style="cursor:pointer;vertical-align:bottom" title="엑셀출력" />
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			
		</div>
		-->
		
	</div>
	<script>
	$(".excel_btn").click(function() {
		var eb1 = $(".select_store").val();
		var eb2 = $(".name1").val();
		location.replace("<?php echo $g4[path]?>/adm/mv_excel.php?eb1=" + eb1 + "&eb2=" + eb2);
	});
	/*
	$(".print_btn").click(function() {
		alert("프린트 출력기능 작업중");
	});
	*/
	</script>
	<script>
	$(".ajax_rst").click(function() {
		var select_store = $(".select_store").val();
		var select_name = $(".name1").val();
		$.ajax({
		type : "POST",
		url : "./ajax_store.php",
		data : {
			a: select_store,
			b: select_name,
		},
		success : function(data){
			$(".ba_list").hide();
			$(".re_list").html(data);
		},
		dataType : "html"
		});
	});
	</script>
	<br />
	<div >
	<table class="board_list" cellpadding="0" cellspacing="0" style="text-align: center">
		<col width="20"/>
		<col width="50" />
	    <col width="150" />
	    <col width="300" />
	    <col width="180" />
		<tr>
		<th></th>
		<th>순번</th>
		<th>성명</th>
		<th>연락처</th>
		<th>정보공개일</th>
		</tr>
		<?php
		for($i = 0; $i < count($list); $i += 1) { 
		$bg = $i%2 ? 0 : 1;
		?>
		<tr class="bg<?=$bg?>">
		<td><?php// echo count($li) - $i;?></td>
		<td><?php echo $list[$i]['id']?></td>
		<td><a href='<?php echo $list[$i]['href']?>'><?php echo $list[$i]['in_name']?></a></td>
		<td><?php echo $list[$i]['in_hp']?></td>
		<td><?php echo $list[$i]['in_day1']?></td>
		</tr>
		<? } ?>
		
	</table>
	</div>
	 <!-- 페이지 -->
    
	<br />
	
	
	<div class="re_list">
	</div>
	<div style="float:right">
		<?php if($is_admin) { ?>
			<a href="<?php echo $write_href ?>"><img src="./img_btn/btn_write.gif" alt="글쓰기" /></a>
		<? } ?>
	</div>
	<!-- 페이지 -->
    <div class="board_page" >
        <? if ($prev_part_href) { echo "<a href='$prev_part_href'><img src='./img_btn/page_search_prev.gif' border='0' align=absmiddle title='이전검색'></a>"; } ?>
       
        <?
        // 기본으로 넘어오는 페이지를 아래와 같이 변환하여 이미지로도 출력할 수 있습니다.
        //echo $write_pages;
        $write_pages = str_replace("처음", "<img src='./img_btn/page_begin.gif' border='0' align='absmiddle' title='처음'>", $write_pages);
        $write_pages = str_replace("이전", "<img src='./img_btn/page_prev.gif' border='0' align='absmiddle' title='이전'>", $write_pages);
        $write_pages = str_replace("다음", "<img src='./img_btn/page_next.gif' border='0' align='absmiddle' title='다음'>", $write_pages);
        $write_pages = str_replace("맨끝", "<img src='./img_btn/page_end.gif' border='0' align='absmiddle' title='맨끝'>", $write_pages);
        //$write_pages = preg_replace("/<span>([0-9]*)<\/span>/", "$1", $write_pages);
        $write_pages = preg_replace("/<b>([0-9]*)<\/b>/", "<b><span style=\"color:#4D6185; font-size:12px; text-decoration:underline;\">$1</span></b>", $write_pages);
        ?>
        <?=$write_pages?>
        <? if ($next_part_href) { echo "<a href='$next_part_href'><img src='./img_btn/page_search_next.gif' border='0' align=absmiddle title='다음검색'></a>"; } ?>
    </div>
</div>
<?
include_once("../admin.tail.php");
?>